package jiwei.bean;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestBean {
    @Test
    public void lifeCycle() {
        //ApplicationContext context = new ClassPathXmlApplicationContext("bean-lifeCycle.xml");
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("bean-lifeCycle.xml");
        Dog dog = context.getBean("dog", Dog.class);
        System.out.println("第4步，获取bean实例对象");
        System.out.println(dog);

        //手动让bean实例销毁
        context.close();
    }
}
